package hu.szyrt.bug.views;

import hu.szyrt.bug.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.ImageView;

public class PlaceImageView2 extends ImageView {

	private Bitmap stampImage1 = null,
	   			   stampImage2 = null,
	   			   drawingClip = null;

	private Paint paint = new Paint();
	
	public PlaceImageView2(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}

	public PlaceImageView2(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public PlaceImageView2(Context context) {
		super(context);
		init(context);
	}
	
	private void init(Context context){
		this.drawingClip = BitmapFactory.decodeResource(getResources(), R.drawable.drawing_clip);
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		if(stampImage1 != null){
			canvas.drawBitmap(
					stampImage1,
					getWidth() - stampImage1.getWidth() - 10,
					getHeight() - (stampImage1.getHeight() * 1.5f) - 10,
					paint
					);
		}
		
		if(stampImage2 != null){
			canvas.drawBitmap(
					stampImage2,
					getWidth() - (stampImage2.getWidth() << 1),
					getHeight() - (stampImage2.getHeight() * 1.5f) - 10,
					paint
					);
		}
		
		if(drawingClip != null){
			canvas.drawBitmap(
					drawingClip,
					getWidth() - (drawingClip.getWidth() << 1) - 5,
					drawingClip.getHeight() - 7,
					paint
					);
		}
	}
	
	
	// Setters ----------------------------------
	public void setStampImage1(Bitmap stampImage1) {
		this.stampImage1 = stampImage1;
	}
	
	public void setStampImage2(Bitmap stampImage2) {
		this.stampImage2 = stampImage2;
	}

}
